package cn.john.hrm.mapper;

import cn.john.hrm.domain.LoginUser;
import cn.john.hrm.domain.Permission;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author john
 * @since 2021-06-17
 */
@Mapper
public interface LoginUserMapper extends BaseMapper<LoginUser> {
    @Select("select  t3.* from t_user_role t1 \n" +
            "left join  t_role_permission t2 on t1.role_id = t2.role_id\n" +
            "left join t_permission t3  on t2.permission_id = t3.id\n" +
            "where t1.user_id = #{id}")
    List<Permission> getUserPermissionsById(Long id);
}
